package com.dodo.blog.ui.component.input;

import com.dodo.blog.ui.util.Localization;

/**
 * @author <a href="mailto:pohorelec@comvai.com">Jozef Pohorelec</a>
 */
public class EnumChoiceRenderer
        implements IChoiceRenderer
{
    @Override
    public String getValue( Object object )
    {
        return ( ( Enum ) object ).name();
    }

    @Override
    public String getLabel( Object object )
    {
        StringBuilder sb = new StringBuilder();
        sb.append( "enum." );
        sb.append( object.getClass().getSimpleName() );
        sb.append( "." );
        sb.append( ( ( Enum ) object ).name() );

        return Localization.localize( sb.toString() );
    }
}
